package com.dean.sql.service.impl;

import com.dean.sql.service.DeanSql;

/**
 * @ClassName DeanMysql
 * @Description
 * @Date 2022/1/1 13:57
 * @Created by dean
 */
public class DeanSqlite implements DeanSql {
    @Override
    public String getTableInfoSql() {
        return  "SELECT  TABLE_COMMENT TABLE_COMMENT ,TABLE_NAME FROM information_schema.`tables` where table_name = ? and table_type='BASE TABLE'";
    }

    @Override
    public String getFieldInfoSql() {
        return "SELECT COLUMN_NAME,COLUMN_COMMENT,DATA_TYPE,COALESCE(numeric_precision,character_maximum_length) DATA_LENGTH ,numeric_scale as DATA_SCALE,'N' as PK_FLAG from information_schema.columns where table_name = ? order by ordinal_position";
    }

    @Override
    public String getPageSql(String sql) {
        String exeSql = "select * from ("+sql+") t limit ?";
        return exeSql;
    }

    @Override
    public String covertTableName(String tableName) {
        return tableName.toLowerCase();
    }
}
